package messages;

import game.Player;


/**
 * UserLoggedIn message
 * 
 * The login message is sent by the server to announce
 * the arrival of a new player
 */
public class UserLoggedInMessage extends Message {
	private static final long serialVersionUID = 1L;
	
	public UserLoggedInMessage(Player player) {
		super();
		this.player = player;
	}
		
	
	public UserLoggedInMessage(Player player, boolean isPrivateMessage) {
		this(player);
		this.isPrivateMessage = isPrivateMessage;
	}
	
	
	public Player getPlayer() {
		return this.player;
	}
	
	
	public boolean isPrivateMessage() {
		return isPrivateMessage;
	}
	
	
	public void setPrivateMessage(boolean isPrivateMessage) {
		this.isPrivateMessage = isPrivateMessage;
	}

	
	@Override
	public String toString() {
		return super.toString() + " UserLoggedIn (" + this.player.getLogin() + ") ";
	}
	
	private Player player; 				// The player who just logged in
	private boolean isPrivateMessage;	// Should the message be sent to everyone or only to the player?
}
